package com.dianshang.controller.task;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dianshang.service.order.CategoryReportService;
import com.dianshang.service.order.OrderService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

//@Component
public class OrderTask {

    @Reference
    private OrderService orderService;

    @Reference
    private CategoryReportService categoryReportService;

    /**
     * 订单超时自动处理
     */
    @Scheduled(cron="0/2 * * * * *")
    public void testTest(){
        System.out.println("执行定时任务"+new Date());
        // orderService.orderOutTime();
    }

    @Scheduled(cron = "0 0 1 * * ?")
    public void createCategoryReportDate(){
        System.out.println("生成类目统计数据"+new Date());
        categoryReportService.createData();
    }

}